<?php

namespace common\model;

use think\model\RelationModel;

class NoteEntityRelationModel extends RelationModel
{
    const RELATION_TYPE_EPISODE = 'episode';
    const RELATION_TYPE_ENTITY = 'entity';
    const RELATION_TYPE_STEP_CATEGORY = 'step_category';
    const RELATION_TYPE_STEP = 'step';
    const RELATION_TYPE_TODO = 'todo';


    const TASK_IS_START_YES = 'yes';
    const TASK_IS_START_NO = 'no';
    const TASK_IS_START_DEFAULT = 'default';


    // 返修接受状态
    const REPAIR_ACCEPT_STATUS_YES = 'yes';
    const REPAIR_ACCEPT_STATUS_NO = 'no';
    const REPAIR_ACCEPT_STATUS_DEFAULT = 'default';

    //自动验证
    protected $_validate = [
        ['note_id', '', '', self::EXISTS_VALIDATE, 'require'],
        ['project_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['entity_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['step_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['version_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['relation_type', ['episode', 'entity', 'step', 'todo', 'scene'], '', self::EXISTS_VALIDATE, 'in'],
        ['relate_module_code', ['asset', 'shot', 'todo'], '', self::EXISTS_VALIDATE, 'in'],
    ];

    //自动完成
    protected $_auto = [
        ['created', 'time', self::MODEL_INSERT, 'function'],
        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
    ];
}
